home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.19990422-19990725 / 000141_news@watsun.cc.columbia.edu _Fri Jun 11 10:55:38 1999.msg < prev    next >
Internet Message Format  |  2020-01-01  |  4KB

  1. Return-Path: <news@watsun.cc.columbia.edu>
  2. Received: from newsmaster.cc.columbia.edu (newsmaster.cc.columbia.edu [128.59.59.30])
  3.     by watsun.cc.columbia.edu (8.8.5/8.8.5) with ESMTP id KAA10721
  4.     for <kermit.misc@watsun.cc.columbia.edu>; Fri, 11 Jun 1999 10:55:38 -0400 (EDT)
  5. Received: (from news@localhost)
  6.     by newsmaster.cc.columbia.edu (8.8.5/8.8.5) id KAA04580
  7.     for kermit.misc@watsun.cc.columbia.edu; Fri, 11 Jun 1999 10:32:28 -0400 (EDT)
  8. X-Authentication-Warning: newsmaster.cc.columbia.edu: news set sender to <news> using -f
  9. From: fdc@watsun.cc.columbia.edu (Frank da Cruz)
  10. Subject: Re: ISO VT320 emulator with key-bindings for Oracle Forms
  11. Date: 11 Jun 1999 14:32:27 GMT
  12. Organization: Columbia University
  13. Message-ID: <7jr6lr$4f1$1@newsmaster.cc.columbia.edu>
  14. To: kermit.misc@watsun.cc.columbia.edu
  15.  
  16. In article <7jr2s5$4sc@web.nmti.com>,
  17. Peter da Silva <peter@baileynm.com> wrote:
  18. : In article <7johsh$egs$1@newsmaster.cc.columbia.edu>,
  19. : Frank da Cruz <fdc@watsun.cc.columbia.edu> wrote:
  20. : >: >And that in any case, this does not solve the original problem:
  21. : >: >
  22. : >: >  How do I map Shift-Alt-F7 to such-and-such a function?
  23. : >: > 
  24. : >: >The answer will still be: "you can't, because the software has no way of
  25. : >: >knowing that you pressed Shift-Alt-F7".
  26. : >: > 
  27. : >: With a keyboard mapping file that maps escape sequences to symbols that
  28. : >: the user's interested in.
  29. : >If xmodmap recognizes your keyboard and can see Shift-Alt-F7 as distinct
  30. : >from other key combinations, then yes, but only for xterm.  A separate
  31. : >solution is required for the console.  Remote (non-X) sessions haven't a
  32. : >prayer.
  33. : Where did I say anything about xmodmap? I'm simply saying that a properly
  34. : written terminal emulator can run on UNIX and provide the functionality
  35. : required. That there isn't one that you know of is because there isn't a
  36. : great need for one, not that one's hard to write.
  37. Sorry, didn't mean to infer statements you didn't make -- after all,
  38. we "da"'s have to stick together :-)
  39.  
  40. But again: in general, there is no API in UNIX to get the keycode of a
  41. keyboard event.
  42.  
  43. PC operating systems like DOS and Windows let you do this at various
  44. levels: per-key up/down events ("make/break codes") at the lowest level,
  45. keycodes representing a composite event (such as "Shift-Alt-F7 was pressed")
  46. at the next level, and ASCII characters at the top level.  In general, UNIX
  47. only gives you the top level.
  48.  
  49. If you have an X application, you can get keycodes.  If your non-X application
  50. is running in an X window, then it will get a stream of ASCII which results
  51. from the X keymap.  A stream of ASCII characters is inherently ambiguous.  If
  52. you get <ESC>OD, is it because the user pressed the Left Arrow key, or because
  53. s/he pressed the Esc key, then the O key, then the D key?
  54.  
  55. If your application is running on the raw console, it *could* get keycodes or
  56. raw key events but there is, in general, no API for this.  Specific UNIX
  57. varieties and versions *might* have such an API, but it will not be portable,
  58. and it can't be used when the application is coming in a serial port, or on
  59. a Telnet or Rlogin connection, or for that matter, in X.
  60.  
  61. Case in point -- Linux has obscure ways to put the console keyboard into
  62. "raw" or "half-cooked" mode, but these are rarely used -- not only because
  63. they are obscure, but because if your application messes up (e.g. crashes)
  64. without putting the keyboard back the way it found it upon exit, you'll need
  65. to pull the plug on your PC before you can use it again.
  66.  
  67. - Frank